package com.leetcode;

public class Test1 {
    public static void main(String[] args) {
        int[]arr;
        arr= new int[]{4, 1};
    }
}

class Solution {
    public String getEncryptedString(String s, int k) {
        char []array=s.toCharArray();
        //数组越界如何解决
        char []newarr=new char[array.length];
        for(int i=0;i<array.length;i++){
            int len=(i+k)%array.length;
            newarr[i]=array[len];
        }
        return new String(newarr);
    }
}
